import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class BackOfficeMain {
	
	public static void main(String[] args)
	{
		ApplicationContext context = new ClassPathXmlApplicationContext("beans-back.xml");
		
		BackOffice backOffice = (BackOffice)context.getBean("backOffice");
		Mail mail = backOffice.receiveMail();
		
		if(mail != null)
		{
			System.out.println("Mail #" + mail.getMailId() + " received.");
		}
		else
		{
			System.out.println("No new mail.");
		}
		
		System.exit(0);
	}
}
